| API Documentation |  |

- MAIN PAGE
- NAMESPACES
- CLASSES

Static Public Member Functions | List of all members
nkAstraeus::MathsLib Class Referencefinal

Shader program helping sources for general maths concepts. More...

## Static Public Member Functions
static nkMemory::StringView | nkSafeAcos ()
static nkMemory::StringView | nkIsNan ()
static nkMemory::StringView | nkComputeLinearDepth ()
static nkMemory::StringView | nkMathsConstants ()

## Detailed Description

Shader program helping sources for general maths concepts.

## Member Function Documentation

## ◆ nkSafeAcos()

static nkMemory::StringView nkAstraeus::MathsLib::nkSafeAcos | ( |  | ) |
| static

float nkSafeAcos (float x) ;

A safe acos version, ensuring the parameter is properly clamped before operating.

Parameter | Description
--- | ---
x | The input for the acos operation.
Returns
The output of the operation.

Returns
  The source for the method described.

## ◆ nkIsNan()

static nkMemory::StringView nkAstraeus::MathsLib::nkIsNan | ( |  | ) |
| static

bool nkIsNan (float x) ;

Checks whether a number is a NaN or not.

Parameter | Description
--- | ---
x | The input to test.
Returns
Whether x is a NaN (true) or not (false).

Returns
  The source for the method described.

## ◆ nkComputeLinearDepth()

static nkMemory::StringView nkAstraeus::MathsLib::nkComputeLinearDepth | ( |  | ) |
| static

float nkComputeLinearDepth (float nonLinearDepth, float projectionA, float projectionB) ;

Converts a non linear depth value, into a linear expression of that same value, for a given camera. The depth value written to the depth buffer during rendering is not linear and compacts more information closer to 1. To reconstruct depth information in a shader, it is usually necessary to map this "logarithmic" distribution into a linear distribution. This allows to easily reconstruct the position in the camera's field of view.

Parameter | Description
--- | ---
nonLinearDepth | The non linear depth, directly sampled from the depth map.
projectionA | The A projection parameter of the camera linked.
projectionB | The B projection parameter of the camera linked.
Returns
The converted value, for the camera parameters given.

To retrieve the parameters, please check nkGraphics::ShaderPassMemorySlot::setAsProjectionParameters(). They can be directly fed to the method.

Returns
  The source for the method described.

## ◆ nkMathsConstants()

static nkMemory::StringView nkAstraeus::MathsLib::nkMathsConstants | ( |  | ) |
| static

Provides with defines of constants :

Name | Value
--- | ---
NK_PI | 3.1415926535

Returns
  The source for the defines described.

The documentation for this class was generated from the following file:

- Documentation/Headers/NilkinsAstraeus/Graphics/ShaderLibs/Maths/MathsLib.h